#include <stdio.h>

void f1(int a, int b, int c, int d, int e, int f, int g)
{
	printf("%d %d %d %d %d %d %d\n", a, b, c, d, e, f, g);
}

int main()
{
	f1(1, 2, 3, 4, 5, 6, 7);
}


#if 0

win: RCX传递类对象的 this 指针、用 RDX 传递函数所需的第一个参数。

gcc: (RDI, RSI, RDX, RCX, R8, R9)


#endif


#if 0
/*
 * intel
 */
0000000000001149 <f1>:
    1149:	f3 0f 1e fa          	endbr64 
    114d:	55                   	push   %rbp
    114e:	48 89 e5             	mov    %rsp,%rbp
    1151:	48 83 ec 20          	sub    $0x20,%rsp
    1155:	89 7d fc             	mov    %edi,-0x4(%rbp)
    1158:	89 75 f8             	mov    %esi,-0x8(%rbp)
    115b:	89 55 f4             	mov    %edx,-0xc(%rbp)
    115e:	89 4d f0             	mov    %ecx,-0x10(%rbp)
    1161:	44 89 45 ec          	mov    %r8d,-0x14(%rbp)
    1165:	44 89 4d e8          	mov    %r9d,-0x18(%rbp)
    1169:	44 8b 45 ec          	mov    -0x14(%rbp),%r8d
    116d:	8b 7d f0             	mov    -0x10(%rbp),%edi
    1170:	8b 4d f4             	mov    -0xc(%rbp),%ecx
    1173:	8b 55 f8             	mov    -0x8(%rbp),%edx
    1176:	8b 45 fc             	mov    -0x4(%rbp),%eax
    1179:	8b 75 10             	mov    0x10(%rbp),%esi
    117c:	56                   	push   %rsi
    117d:	8b 75 e8             	mov    -0x18(%rbp),%esi
    1180:	56                   	push   %rsi
    1181:	45 89 c1             	mov    %r8d,%r9d
    1184:	41 89 f8             	mov    %edi,%r8d
    1187:	89 c6                	mov    %eax,%esi
    1189:	48 8d 3d 74 0e 00 00 	lea    0xe74(%rip),%rdi        # 2004 <_IO_stdin_used+0x4>
    1190:	b8 00 00 00 00       	mov    $0x0,%eax
    1195:	e8 b6 fe ff ff       	callq  1050 <printf@plt>
    119a:	48 83 c4 10          	add    $0x10,%rsp
    119e:	90                   	nop
    119f:	c9                   	leaveq 
    11a0:	c3                   	retq   

00000000000011a1 <main>:
    11a1:	f3 0f 1e fa          	endbr64 
    11a5:	55                   	push   %rbp
    11a6:	48 89 e5             	mov    %rsp,%rbp
    11a9:	48 83 ec 08          	sub    $0x8,%rsp
    11ad:	6a 07                	pushq  $0x7
    11af:	41 b9 06 00 00 00    	mov    $0x6,%r9d
    11b5:	41 b8 05 00 00 00    	mov    $0x5,%r8d
    11bb:	b9 04 00 00 00       	mov    $0x4,%ecx
    11c0:	ba 03 00 00 00       	mov    $0x3,%edx
    11c5:	be 02 00 00 00       	mov    $0x2,%esi
    11ca:	bf 01 00 00 00       	mov    $0x1,%edi
    11cf:	e8 75 ff ff ff       	callq  1149 <f1>
    11d4:	48 83 c4 10          	add    $0x10,%rsp
    11d8:	b8 00 00 00 00       	mov    $0x0,%eax
    11dd:	c9                   	leaveq 
    11de:	c3                   	retq   
    11df:	90                   	nop

/*
 * arm
 */
000000000040055c <f1>:
  40055c:	a9bd7bfd 	stp	x29, x30, [sp, #-48]!
  400560:	910003fd 	mov	x29, sp
  400564:	b9002fa0 	str	w0, [x29, #44]
  400568:	b9002ba1 	str	w1, [x29, #40]
  40056c:	b90027a2 	str	w2, [x29, #36]
  400570:	b90023a3 	str	w3, [x29, #32]
  400574:	b9001fa4 	str	w4, [x29, #28]
  400578:	b9001ba5 	str	w5, [x29, #24]
  40057c:	b90017a6 	str	w6, [x29, #20]
  400580:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  400584:	911a6000 	add	x0, x0, #0x698
  400588:	b94017a7 	ldr	w7, [x29, #20]
  40058c:	b9401ba6 	ldr	w6, [x29, #24]
  400590:	b9401fa5 	ldr	w5, [x29, #28]
  400594:	b94023a4 	ldr	w4, [x29, #32]
  400598:	b94027a3 	ldr	w3, [x29, #36]
  40059c:	b9402ba2 	ldr	w2, [x29, #40]
  4005a0:	b9402fa1 	ldr	w1, [x29, #44]
  4005a4:	97ffffab 	bl	400450 <printf@plt>
  4005a8:	d503201f 	nop
  4005ac:	a8c37bfd 	ldp	x29, x30, [sp], #48
  4005b0:	d65f03c0 	ret

00000000004005b4 <main>:
  4005b4:	a9bf7bfd 	stp	x29, x30, [sp, #-16]!
  4005b8:	910003fd 	mov	x29, sp
  4005bc:	528000e6 	mov	w6, #0x7                   	// #7
  4005c0:	528000c5 	mov	w5, #0x6                   	// #6
  4005c4:	528000a4 	mov	w4, #0x5                   	// #5
  4005c8:	52800083 	mov	w3, #0x4                   	// #4
  4005cc:	52800062 	mov	w2, #0x3                   	// #3
  4005d0:	52800041 	mov	w1, #0x2                   	// #2
  4005d4:	52800020 	mov	w0, #0x1                   	// #1
  4005d8:	97ffffe1 	bl	40055c <f1>
  4005dc:	52800000 	mov	w0, #0x0                   	// #0
  4005e0:	a8c17bfd 	ldp	x29, x30, [sp], #16
  4005e4:	d65f03c0 	ret

#endif

